﻿using SmartSapce.ServiceLocation;
using SmartSpace.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SmartSpace.WebApp._handlers._private
{
    /// <summary>
    /// Summary description for get_page_tplt
    /// </summary>
    public class get_page_tplt : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            Guid id = new Guid(context.Request.QueryString["id"]);
            ICoreService service = ServiceLocator.Get<ICoreService>();
            PageTemplate template = service.GetPageTemplate(id);
            context.Response.ContentType = "document/tplt";
            context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            context.Response.BinaryWrite(template.Data);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}